package controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@ControllerAdvice
public class ExceptionHandlerController {

    @ExceptionHandler
    public ModelAndView handle(HttpServletRequest request, HttpServletResponse response,Exception ex){
        ModelAndView mv = new ModelAndView();
        mv.setViewName("Error/error");
        return mv;
    }
}
